home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Timer.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  3KB  |  142 lines

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Contains:    Time Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __TIMER__
  19. #define __TIMER__
  20.  
  21. #ifndef __CONDITIONALMACROS__
  22. #include <ConditionalMacros.h>
  23. #endif
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. #ifndef __OSUTILS__
  28. #include <OSUtils.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  44.  
  45. enum {
  46.                                                                 /* high bit of qType is set if task is active */
  47.     kTMTaskActive                = (1L << 15)
  48. };
  49.  
  50. /*
  51.         This ProcPtr uses register based parameters on the 68k and cannot
  52.         be written in or called from a high-level language without the help of
  53.         mixed mode or assembly glue.
  54.  
  55.             typedef pascal void (*TimerProcPtr)(TMTaskPtr tmTaskPtr);
  56.  
  57. */
  58.  
  59. #if GENERATINGCFM
  60. typedef UniversalProcPtr TimerUPP;
  61. #else
  62. typedef Register68kProcPtr TimerUPP;
  63. #endif
  64. struct TMTask {
  65.     QElemPtr                         qLink;
  66.     short                             qType;
  67.     TimerUPP                         tmAddr;
  68.     long                             tmCount;
  69.     long                             tmWakeUp;
  70.     long                             tmReserved;
  71. };
  72. typedef struct TMTask TMTask;
  73.  
  74. typedef TMTask *TMTaskPtr;
  75.  
  76. #if GENERATING68K && !GENERATINGCFM
  77. #pragma parameter InsTime(__A0)
  78. #endif
  79. extern pascal void InsTime(QElemPtr tmTaskPtr)
  80.  ONEWORDINLINE(0xA058);
  81.  
  82.  
  83. #if GENERATING68K && !GENERATINGCFM
  84. #pragma parameter InsXTime(__A0)
  85. #endif
  86. extern pascal void InsXTime(QElemPtr tmTaskPtr)
  87.  ONEWORDINLINE(0xA458);
  88.  
  89.  
  90. #if GENERATING68K && !GENERATINGCFM
  91. #pragma parameter PrimeTime(__A0, __D0)
  92. #endif
  93. extern pascal void PrimeTime(QElemPtr tmTaskPtr, long count)
  94.  ONEWORDINLINE(0xA05A);
  95.  
  96.  
  97. #if GENERATING68K && !GENERATINGCFM
  98. #pragma parameter RmvTime(__A0)
  99. #endif
  100. extern pascal void RmvTime(QElemPtr tmTaskPtr)
  101.  ONEWORDINLINE(0xA059);
  102.  
  103. extern pascal void Microseconds(UnsignedWide *microTickCount)
  104.  FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  105.  
  106.  
  107. enum {
  108.     uppTimerProcInfo = kRegisterBased
  109.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(TMTaskPtr)))
  110. };
  111.  
  112. #if GENERATINGCFM
  113. #define NewTimerProc(userRoutine)        \
  114.         (TimerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  115. #else
  116. #define NewTimerProc(userRoutine)        \
  117.         ((TimerUPP) (userRoutine))
  118. #endif
  119.  
  120. #if GENERATINGCFM
  121. #define CallTimerProc(userRoutine, tmTaskPtr)        \
  122.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTimerProcInfo, (tmTaskPtr))
  123. #else
  124. /* (*TimerUPP) cannot be called from a high-level language without the Mixed Mode Manager */
  125. #endif
  126. #endif
  127.  
  128. #if PRAGMA_ALIGN_SUPPORTED
  129. #pragma options align=reset
  130. #endif
  131.  
  132. #if PRAGMA_IMPORT_SUPPORTED
  133. #pragma import off
  134. #endif
  135.  
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139.  
  140. #endif /* __TIMER__ */
  141.  
  142.